home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Chip 2011 November
/
CHIP_2011_11.iso
/
Programy
/
Inne
/
Gry
/
Carnage_Contest
/
scripts
/
CC Original
/
tools
/
Castle Kit.lua
< prev
next >
Wrap
Text File
|
2009-09-15
|
2KB
|
51 lines
--------------------------------------------------------------------------------
-- Weapon Castle Kit
-- Original Carnage Contest Weapon
-- Script by DC, August 2009, www.UnrealSoftware.de
--------------------------------------------------------------------------------
-- Setup Tables
if cc==nil then cc={} end
cc.castlekit={}
-- Load & Prepare Ressources
cc.castlekit.gfx_wpn=loadgfx("weapons/castlekit.bmp") -- Weapon Image
setmidhandle(cc.castlekit.gfx_wpn)
cc.castlekit.gfx_stone=loadgfx("buildings/block.bmp") -- Block Image
setmidhandle(cc.castlekit.gfx_stone)
cc.castlekit.sfx_build=loadsfx("buildstone.ogg") -- Build Sound
--------------------------------------------------------------------------------
-- Weapon: Castle Kit
--------------------------------------------------------------------------------
cc.castlekit.id=addweapon("cc.castlekit","Castle Kit",cc.castlekit.gfx_wpn,0) -- Add Weapon (0 uses)
cc.castlekit.ammo=15 -- Stones
function cc.castlekit.draw() -- Draw
-- HUD Positioning
if weapon_shots<cc.castlekit.ammo then
hudpositioning(pos_build,cc.castlekit.gfx_stone,250)
end
-- HUD ammobar
if cc.castlekit.ammo-weapon_shots>0 then
hudammobar(cc.castlekit.ammo-weapon_shots,cc.castlekit.ammo)
end
end
function cc.castlekit.attack(attack) -- Attack
if (weapon_shots<=cc.castlekit.ammo) and (weapon_position==1) then
weapon_position=0
-- No more weapon switching!
useweapon(0)
weapon_shots=weapon_shots+1
-- Draw
terrainimage(cc.castlekit.gfx_stone,weapon_x,weapon_y)
-- Sound
playsound(cc.castlekit.sfx_build)
-- End Turn?
if (weapon_shots>=cc.castlekit.ammo) then
endturn()
end
end
end